Skip to content

Conversation

@kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Nov 7, 2024

The changes in 461f859 (#65974) resulted in a change in behavior not just for completion, but also for selection of inexect commands.

Since many use e to mean expression, this change adds an alias for e. Note that the referenced change similarly aliases h to help.

The changes in 461f859 (llvm#65974) resulted in a change in
behavior not just for completion, but also for selection of inexect commands.

Since many use `e` to mean `expression`, this change adds an alias for `e`.
Note that the referenced change similarly aliases `h` to `help`.
@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2024

@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)

Changes

The changes in 461f859 (llvm/llvm-project#65974) resulted in a change in behavior not just for completion, but also for selection of inexect commands.

Since many use e to mean expression, this change adds an alias for e. Note that the referenced change similarly aliases h to help.


Full diff: https://github.com/llvm/llvm-project/pull/115359.diff

2 Files Affected:

  • (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+2)
  • (modified) lldb/test/API/functionalities/abbreviation/TestAbbreviations.py (+4)
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index c990972ca64bcf..227ed802aa933c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -441,6 +441,8 @@ void CommandInterpreter::Initialize() {
 
   cmd_obj_sp = GetCommandSPExact("expression");
   if (cmd_obj_sp) {
+    // Ensure `e` runs `expression`.
+    AddAlias("e", cmd_obj_sp);
     AddAlias("call", cmd_obj_sp, "--")->SetHelpLong("");
     CommandAlias *parray_alias =
         AddAlias("parray", cmd_obj_sp, "--element-count %1 --");
diff --git a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
index 02ee581da516d4..a8cbffbb7ba4a5 100644
--- a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
@@ -20,6 +20,10 @@ def test_command_abbreviations_and_aliases(self):
         self.assertTrue(result.Succeeded())
         self.assertEqual("apropos script", result.GetOutput())
 
+        command_interpreter.ResolveCommand("e", result)
+        self.assertTrue(result.Succeeded())
+        self.assertEqual("expression", result.GetOutput())
+
         command_interpreter.ResolveCommand("h", result)
         self.assertTrue(result.Succeeded())
         self.assertEqual("help", result.GetOutput())

Copy link
Collaborator

@jimingham jimingham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expr is much more common than exit or env so this seems like a fine idea.

@kastiglione kastiglione merged commit 60e3a81 into llvm:main Nov 7, 2024
7 of 8 checks passed
@kastiglione kastiglione deleted the lldb-Add-builtin-e-alias-for-expression branch November 7, 2024 19:24
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Nov 7, 2024
The changes in 461f859 (llvm#65974) resulted in a change
in behavior not just for completion, but also for selection of inexect
commands.

Since many use `e` to mean `expression`, this change adds an alias for
`e`. Note that the referenced change similarly aliases `h` to `help`.

(cherry picked from commit 60e3a81)
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Nov 8, 2024
The changes in 461f859 (llvm#65974) resulted in a change
in behavior not just for completion, but also for selection of inexect
commands.

Since many use `e` to mean `expression`, this change adds an alias for
`e`. Note that the referenced change similarly aliases `h` to `help`.

(cherry picked from commit 60e3a81)
Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
The changes in 461f859 (llvm#65974) resulted in a change
in behavior not just for completion, but also for selection of inexect
commands.

Since many use `e` to mean `expression`, this change adds an alias for
`e`. Note that the referenced change similarly aliases `h` to `help`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants